import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:wan_android_flutter/common/base/base_page.dart';
import 'package:wan_android_flutter/common/resources/spacing.dart';
import 'package:wan_android_flutter/common/resources/text_styles.dart';
import 'package:wan_android_flutter/common/routes/route_manager.dart';
import 'package:wan_android_flutter/common/widget/material_layout.dart';
import 'package:wan_android_flutter/generated/locales.g.dart';
import 'package:wan_android_flutter/res/assets_res.dart';

import 'drawer_logic.dart';

class DrawerPage extends BasePage<DrawerLogic> {
  DrawerPage({super.key});

  @override
  bool showAppBar() {
    return false;
  }

  @override
  Widget buildContent(BuildContext context) {
    return Column(
      mainAxisAlignment: MainAxisAlignment.start,
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        Container(
          color: colorData.textBlue,
          width: double.infinity,
          padding: const EdgeInsets.only(top: 60),
          height: 200,
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              Image.asset(
                AssetsRes.HEAD,
                width: 60,
                height: 60,
              ),
              Spacing.vSpacing10,
              SizedBox(
                height: 40,
                child: Obx(() {
                  if (logic.state.userName.value.isNotEmpty) {
                    return Text(
                      logic.state.userName.value,
                      style: colorData.textWhite.s20.regular,
                    );
                  } else {
                    return InkWell(
                      onTap: () {
                        Get.toNamed(RouteManager.loginPage);
                      },
                      child: Text(
                        LocaleKeys.unlogin.tr,
                        style: colorData.textWhite.s20.regular,
                      ),
                    );
                  }
                }),
              )
            ],
          ),
        ),
        MaterialLayout(
            backgroundColor: colorData.bgWhite,
            onPressed: () {
              Get.toNamed(RouteManager.favoritePage);
            },
            padding: const EdgeInsets.all(16),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.start,
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                Image.asset(
                  AssetsRes.HEART,
                  width: 20,
                  height: 20,
                ),
                Spacing.hSpacing10,
                Text(
                  LocaleKeys.like.tr,
                  style: colorData.textBlack.s18.regular,
                )
              ],
            )),
        MaterialLayout(
            backgroundColor: colorData.bgWhite,
            onPressed: () {},
            padding: const EdgeInsets.all(16),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.start,
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                Image.asset(
                  AssetsRes.HEART,
                  width: 20,
                  height: 20,
                ),
                Spacing.hSpacing10,
                Text(
                  LocaleKeys.about.tr,
                  style: colorData.textBlack.s18.regular,
                )
              ],
            ))
      ],
    );
  }
}
